﻿using Furion.DatabaseAccessor;
using System;
using System.ComponentModel.DataAnnotations;
using YFurion.Locators;

namespace YFurion.Entities
{
    [Serializable]
    public abstract class FullEntity : FullEntityOfTKey<long>, IYEntity, IFullAudited
    {
        [Key]
        public override long Id { get; set; }
    }

    [Serializable]
    public abstract class FullEntity<TDbContextLocator1, TDbContextLocator2> :
        FullEntityOfTKey<long, TDbContextLocator1, TDbContextLocator2>,
        IYEntity<TDbContextLocator1, TDbContextLocator2>,
        IFullAudited
        where TDbContextLocator1 : class, IDbContextLocator
        where TDbContextLocator2 : class, IDbContextLocator
    {
        [Key]
        public override long Id { get; set; }
    }

    [Serializable]
    public abstract class FullEntityOfTKey<TKey> : FullEntityOfTKey<TKey, MasterDbContextLocator, SlaveDbContextLocator>, IYEntityOfTKey<TKey>, IFullAudited<TKey>
    {
    }

    [Serializable]
    public abstract class FullEntityOfTKey<TKey, TDbContextLocator1, TDbContextLocator2> : FullEntityBase<TKey>,
        IYEntityOfTKey<TKey, TDbContextLocator1, TDbContextLocator2>,
        IFullAudited<TKey>
        where TDbContextLocator1 : class, IDbContextLocator
        where TDbContextLocator2 : class, IDbContextLocator
    {
    }

    [Serializable]
    public abstract class FullEntityBase<TKey> : CMEntityBase<TKey>,
        IFullAudited<TKey>
    {
        public virtual bool IsDeleted { get; set; }

        public virtual TKey DeleterUserId { get; set; }

        public virtual DateTime? DeletionTime { get; set; }
    }
}
